import { defineStore } from "pinia"

export const useCountStore = defineStore('count', {
  state() {
    return {
      sum: 6,
      name: '张三'
    }
  },
  actions: {
    increment(value: number) {
      if (this.sum < 10) {
        // this为当前store
        this.sum += value
        this.name += '~'
      }
    }
  },
  getters: {
    bigSum: state => state.sum * 100
  }
})